template <typename alc, int s> struct alc_queue {
	alc qu[s + 5];
	int f = 0, rear = 0, count = 0;
	void push(alc x) {
		if (count >= s) {
			throw overflow_error("alc_queue overflow");
		}
		qu[rear] = x;
		rear = (rear + 1) % s;
		count++;
	}
	alc pop() {
		if (count <= 0) {
			throw underflow_error("alc_queue underflow qwq");
		}
		alc val = qu[f];
		f = (f + 1) % s;
		count--;
		return val;
	}
	alc front() {
		if (count == 0) {
		throw out_of_range("alc_queue is empty qwq");
		} else return qu[f];
	}
	int size() {
		return count;
	}
	bool empty() {
		return !count;
	}
	void clear() {
		f = rear = count = 0;
	}
	alc back() {
		if (count == 0) {
			throw out_of_range("alc_queue is empty qwq");
		} else return qu[(rear - 1 + s) % s];
	}
};